//
//	ZcoModelUserInfo.m
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "ZcoModelUserInfo.h"

NSString *const kZcoModelUserInfoAccessToken = @"accessToken";
NSString *const kZcoModelUserInfoTicket = @"ticket";
NSString *const kZcoModelUserInfoTicketExpiresIn = @"ticketExpiresIn";
NSString *const kZcoModelUserInfoTokenData = @"tokenData";
NSString *const kZcoModelUserInfoUrls = @"urls";

@interface ZcoModelUserInfo ()
@end
@implementation ZcoModelUserInfo




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kZcoModelUserInfoAccessToken] isKindOfClass:[NSNull class]]){
		self.accessToken = dictionary[kZcoModelUserInfoAccessToken];
	}	
	if(![dictionary[kZcoModelUserInfoTicket] isKindOfClass:[NSNull class]]){
		self.ticket = dictionary[kZcoModelUserInfoTicket];
	}	
	if(![dictionary[kZcoModelUserInfoTicketExpiresIn] isKindOfClass:[NSNull class]]){
		self.ticketExpiresIn = [dictionary[kZcoModelUserInfoTicketExpiresIn] integerValue];
	}

	if(![dictionary[kZcoModelUserInfoTokenData] isKindOfClass:[NSNull class]]){
		self.tokenData = [[ZcoModelTokenData alloc] initWithDictionary:dictionary[kZcoModelUserInfoTokenData]];
	}

	if(![dictionary[kZcoModelUserInfoUrls] isKindOfClass:[NSNull class]]){
		self.urls = [[ZcoModelConfigUrls alloc] initWithDictionary:dictionary[kZcoModelUserInfoUrls]];
	}

	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.accessToken != nil){
		dictionary[kZcoModelUserInfoAccessToken] = self.accessToken;
	}
	if(self.ticket != nil){
		dictionary[kZcoModelUserInfoTicket] = self.ticket;
	}
	dictionary[kZcoModelUserInfoTicketExpiresIn] = @(self.ticketExpiresIn);
	if(self.tokenData != nil){
		dictionary[kZcoModelUserInfoTokenData] = [self.tokenData toDictionary];
	}
	if(self.urls != nil){
		dictionary[kZcoModelUserInfoUrls] = [self.urls toDictionary];
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.accessToken != nil){
		[aCoder encodeObject:self.accessToken forKey:kZcoModelUserInfoAccessToken];
	}
	if(self.ticket != nil){
		[aCoder encodeObject:self.ticket forKey:kZcoModelUserInfoTicket];
	}
	[aCoder encodeObject:@(self.ticketExpiresIn) forKey:kZcoModelUserInfoTicketExpiresIn];	if(self.tokenData != nil){
		[aCoder encodeObject:self.tokenData forKey:kZcoModelUserInfoTokenData];
	}
	if(self.urls != nil){
		[aCoder encodeObject:self.urls forKey:kZcoModelUserInfoUrls];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.accessToken = [aDecoder decodeObjectForKey:kZcoModelUserInfoAccessToken];
	self.ticket = [aDecoder decodeObjectForKey:kZcoModelUserInfoTicket];
	self.ticketExpiresIn = [[aDecoder decodeObjectForKey:kZcoModelUserInfoTicketExpiresIn] integerValue];
	self.tokenData = [aDecoder decodeObjectForKey:kZcoModelUserInfoTokenData];
	self.urls = [aDecoder decodeObjectForKey:kZcoModelUserInfoUrls];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	ZcoModelUserInfo *copy = [ZcoModelUserInfo new];

	copy.accessToken = [self.accessToken copy];
	copy.ticket = [self.ticket copy];
	copy.ticketExpiresIn = self.ticketExpiresIn;
	copy.tokenData = [self.tokenData copy];
	copy.urls = [self.urls copy];

	return copy;
}
@end
